home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Developer Utilities / Installer 4.0.3 SDK / Script Examples / ResList [inr#] Example / myResList.r < prev    next >
Encoding:
Text File  |  1994-11-15  |  7.9 KB  |  257 lines  |  [TEXT/MPS ]

  1. //
  2. //    myResList.r
  3. //
  4. //        This installer script source demonstrates use of Resource List atoms.
  5. //
  6. //    NOTE: This example uses pre-4.0 method for creating Custom Install options.
  7. //    It is not intended as an example of how to use 4.0 User Interface features.
  8. //
  9. //
  10. //        mark young • 08/18/94
  11. //
  12. //        Copyright 1993-1994, Apple Computer, Inc., All Rights Reserved
  13. //
  14.  
  15. #include "InstallerTypes.r"
  16.  
  17. // • packages
  18.  
  19. resource 'inpk' (100) {
  20.     format0 {
  21.         showsOnCustom,
  22.         removable,
  23.         dontForceRestart,
  24.         0,
  25.         0,
  26.         "ResList - add 'vers' ( 3 ) to TeachText ( tgt req'd ) on root of tgt volume.",
  27.         {    
  28.         // even though this is within an 'inr#' you should specify 'inra'
  29.         'inra', 9000;    // this ID is the same as the first field
  30.                         // for the desired item record in the 'inr#'
  31.         },
  32.     }
  33. };
  34.  
  35. resource 'inpk' (200) {
  36.     format0 {
  37.         showsOnCustom,
  38.         removable,
  39.         dontForceRestart,
  40.         0,
  41.         0,
  42.         "ResList - add 'vers' ( 4 ) to TeachText ( no tgt req'd ) on root of tgt vol.",
  43.         {    
  44.         // even though this is within an 'inr#' you should specify 'inra'
  45.         'inra', 9001;    // this ID is the same as the first field
  46.                         // for the desired item record in the 'inr#'
  47.         },
  48.     }
  49. };
  50.  
  51. resource 'inpk' (300) {
  52.     format0 {
  53.         showsOnCustom,
  54.         removable,
  55.         dontForceRestart,
  56.         0,
  57.         0,
  58.         "ResList - add 'vers' ( 5 ) to TeachText ( no tgt req'd ) on root of tgt vol.",
  59.         {    
  60.         // even though this is within an 'inr#' you should specify 'inra'
  61.         'inra', 9002;    // this ID is the same as the first field
  62.                         // for the desired item record in the 'inr#'
  63.         },
  64.     }
  65. };
  66.  
  67.  
  68. // • ResList atoms
  69.  
  70. // NOTE - in this example resource list atom ( 'inr#' ), all resource 
  71. // items are contained in the same source file, and all resource items 
  72. // will be installed to the same target file.
  73.  
  74. // If you wish to store different resource items contained in the 
  75. // resource list atom in different source files, just declare the 
  76. // appropriate  'infs' spec for each source file and designate the 
  77. // different source files for each resource item in its section 
  78. // of the 'inr#'
  79.  
  80. // If you wish to install different resource items contained in the 
  81. // resource list atom to different target files, just declare the 
  82. // appropriate  'intf' spec for each target file and designate the 
  83. // different target files for each resource item in its section 
  84. // of the 'inr#'
  85.  
  86. // IMPORTANT SAFETY TIP :
  87. // The first resource item below specifies the flag 'tgtRequired' and
  88. // will generate an installation error if the target file "TeachText"
  89. // does not already exist on the root folder of the tgt volume.
  90.  
  91. // The other resource items specify the flag 'noTgtRequired' and will
  92. // create a bogus copy of "TeachText" on the root folder of the tgt 
  93. // volume that contains only the resource items just installed. It
  94. // will NOT generate an installation error. Scriptwriters should take
  95. // care when specifying 'noTgtRequired' during resource installation.
  96.  
  97. // ResList atom for source >> TeachText on root folder of tgt volume
  98. resource 'inr#' (1000) {        // use any unique ID, 
  99.                                 // this ID will not be referenced
  100.  
  101.         // NOTE: The resource ID for the ResList resource  ( 'inr#' )
  102.         // is treated differently than all other installer resource types
  103.         // to be referenced from with a package resource ( 'inpk' ).
  104.         
  105.         // Normally ( as with Resource atoms [ 'inra' ] ), the resource
  106.         // type and the resource ID of the atom are specified within
  107.         // the package contents list. With ResList atoms ( 'inr#' )
  108.         // the ResList resource item is treated as a list of Resource
  109.         // atoms, rather than as a complete unit to be added to packages.
  110.         // When specifying the contents of an 'inr#' from within an 'inpk',
  111.         // specify the resource type 'inra' and the value specified in the
  112.         // first field of the set of fields that represent one resource item
  113.         // within the ResList atom ( 'inr#' ). The first two resource items
  114.         // in this ResList atom, for example, would be added to a package
  115.         // by specifying [ 'inra', 9000 ] and [ 'inra', 9001 ].
  116.  
  117.         // • first resource item in resource list for atom
  118.         
  119.         9000,                     // Resource ID listed in 'inpk'
  120.         
  121.         deleteWhenRemoving,
  122.         dontDeleteWhenInstalling,
  123.         copy,
  124.         leaveAloneIfNewer,    // ?? this got set as updateEvenIfNewer = ON
  125.  
  126.         noTgtRequired,
  127.         updateExisting,
  128.         copyIfNewOrUpdate,
  129.         dontIgnoreProtection,
  130.         srcNeedExist,
  131.         byID,
  132.         nameNeedNotMatch,
  133.         
  134.         0,                    // Size of Resource Item
  135.         10000,                // TARGET - file spec ( 'intf' )
  136.         10000,                // SOURCE - file spec ( 'infs' )
  137.         'vers',                // Resource Item Type ( source and target )
  138.         3,                    // Resource Item ID ( source and target )
  139.         0,                    // Resource Item Attributes
  140.         
  141.         0x0,                // Source Version Number - BCD format
  142.         0,                    // Version Compare Proc ID
  143.         0,                    // Atom Extender ID ( not currently supported )
  144.         0,                    // TARGET - size of resource
  145.  
  146.  
  147.         // • next resource item in resource list for atom
  148.         
  149.         9001,                     // Resource ID listed in 'inpk'
  150.         
  151.         deleteWhenRemoving,
  152.         dontDeleteWhenInstalling,
  153.         copy,
  154.         leaveAloneIfNewer,    // ?? this got set as updateEvenIfNewer = ON
  155.  
  156.         noTgtRequired,
  157.         updateExisting,
  158.         copyIfNewOrUpdate,
  159.         dontIgnoreProtection,
  160.         srcNeedExist,
  161.         byID,
  162.         nameNeedNotMatch,
  163.         
  164.         0,                    // Size of Resource Item
  165.         10000,                // TARGET - file spec ( 'intf' )
  166.         10000,                // SOURCE - file spec ( 'infs' )
  167.         'vers',                // Resource Item Type ( source and target )
  168.         3,                    // Resource Item ID ( source and target )
  169.         0,                    // Resource Item Attributes
  170.         
  171.         0x0,                // Source Version Number - BCD format
  172.         0,                    // Version Compare Proc ID
  173.         0,                    // Atom Extender ID ( not currently supported )
  174.         0,                    // TARGET - size of resource
  175.  
  176.  
  177.         // • next resource item in resource list for atom
  178.         
  179.         9002,                     // Resource ID listed in 'inpk'
  180.         
  181.         deleteWhenRemoving,
  182.         dontDeleteWhenInstalling,
  183.         copy,
  184.         leaveAloneIfNewer,    // ?? this got set as updateEvenIfNewer = ON
  185.  
  186.         noTgtRequired,
  187.         updateExisting,
  188.         copyIfNewOrUpdate,
  189.         dontIgnoreProtection,
  190.         srcNeedExist,
  191.         byID,
  192.         nameNeedNotMatch,
  193.         
  194.         0,                    // Size of Resource Item
  195.         10000,                // TARGET - file spec ( 'intf' )
  196.         10000,                // SOURCE - file spec ( 'infs' )
  197.         'vers',                // Resource Item Type ( source and target )
  198.         3,                    // Resource Item ID ( source and target )
  199.         0,                    // Resource Item Attributes
  200.         
  201.         0x0,                // Source Version Number - BCD format
  202.         0,                    // Version Compare Proc ID
  203.         0,                    // Atom Extender ID ( not currently supported )
  204.         0,                    // TARGET - size of resource
  205.     }}
  206. };
  207.  
  208.  
  209. // • file specs
  210.  
  211.  
  212. // target file spec for TeachText application on root of target volume
  213. // NOTE: When a target spec is called from within a resource atom of
  214. // any kind ( 'inra', 'inrm', 'inr#' ), the type, creator, dates and
  215. // Finder attributes fields will only apply when creating a new file.
  216. resource 'intf' (10000) {
  217.     format1 {
  218.         noSearchForFile,                 // use default search path
  219.         
  220.         TypeCrMustMatch,                 // If this is set to TypeCrMustMatch
  221.                                         // then a file with a different type
  222.                                         // and creator than those specified
  223.                                         // below will not be updated.
  224.                                         // If this is set to TypeCrNeedNotMatch
  225.                                         // then type and creator of an existing
  226.                                         // target file are ignored.
  227.         
  228.         // The Type and Creator fields will be used to set the
  229.         // file's Type and Creator when a new file is created. 
  230.         'APPL',                         // TYPE for new file
  231.         'ttxt',                         // CREATOR for new file
  232.         
  233.         0,                                 // finder attribute flags
  234.                                         // filled by ScriptCheck is value is 0
  235.         
  236.         1,                                  // creation date for new file
  237.         1,                                  // modification date for new file
  238.                                         // NOTE: DATE values are filled
  239.                                         // by ScriptCheck if the value is 1
  240.                                             
  241.         0,                                 // search proc ID ( 'insp' ), none used
  242.         
  243.         ":TeachText"            // path to target file
  244.         }
  245.     };
  246.  
  247. // shared source file spec for ResMerge source file
  248. resource 'infs' (10000) {
  249.     'rsrc',                        // TYPE for source file
  250.     'RSED',                        // CREATOR for source file
  251.     0x1,                        // creation DATE for source file
  252.     noSearchForFile,            // IGNORED in Installer 4.0.x
  253.     TypeCrMustMatch,            // TYPE, CREATOR must match file on install disk
  254.     "Disk 1:ResListSource.rsrc"    // PATH to source file        
  255. };
  256.  
  257.